/* 深拷贝函数 */
export default function deepClone<T>(obj: T): T {
    if (typeof obj !== "object" || obj === null) {
        return obj;
    }
    if (Array.isArray(obj)) {
        return obj.map((item) => deepClone(item)) as unknown as T;
    }
    const newObj = {} as T;
    Object.entries(obj).forEach(([key, value]) => {
        newObj[key as keyof T] = deepClone(value) as T[keyof T];
    });
    return newObj;
}
